'use strict';

module.exports = {
  // 登陆请求响应定义
  login: {
    request: () => {
      return {
        loginName: { type: 'string', required: true },
        loginPwd: { type: 'string', required: true },
      };
    },
    response: () => {
      return {
        id: { type: 'string', required: true },
        token: { type: 'string', required: true },
        sysMenusTree: { type: 'json', required: true },
      };
    },
  },
  // 查询所有用户（支持分页）
  queryAdminUsersList: {
    request: () => {
      return {
        loginName: { type: 'string', required: false },
        branchCode: { type: 'string', required: false }, // 单位编号
        roleId: { type: 'int', required: false }, // 角色ID
        state: { type: 'int', required: false }, // 状态
        startDate: { type: 'string', required: false }, // 开始时间
        endDate: { type: 'string', required: false }, // 结束时间
        pageSize: { type: 'number', required: true, min: 1 }, // 一页多少条
        pageIndex: { type: 'number', required: true, min: 1 }, // 第几页
      };
    },
    response: () => {
      return {
        pageCount: { type: 'int', required: true }, // 页数总和 
        dataCount: { type: 'int', required: true }, // 总数据量
        adminUsersList: [],
      };
    },
  },
  // 用户详情
  queryAdminUser: {
    request: () => {
      return {
        id: { type: 'string', required: true },
      };
    },
    response: () => {
      return {
        id: { type: '', required: false },
        loginName: { type: '', required: false },
        state: { type: '', required: false },
        realName: { type: '', required: false },
        gender: { type: '', required: false },
        branchCode: { type: '', required: false },
        remarks: { type: '', required: false },
        creator: { type: '', required: false },
        createTime: { type: '', required: false },
        updateTime: { type: '', required: false },
      };
    },
  },
  // 添加用户请求响应定义
  addAdminUser: {
    request: () => {
      return {
        loginName: { type: 'string', required: true },
        loginPwd: { type: 'string', required: true },
        realName: { type: 'string', required: true },
        roleId: { type: 'int', required: true },
        gender: { type: 'int', required: true },
        branchCode: { type: 'string', required: true },
        remarks: { type: 'string', required: false },
      };
    },
  },
  // 删除用户
  deleteAdminUser: {
    request: () => {
      return {
        id: { type: 'string', required: true },
      };
    },
  },
  // 更新用户信息
  updateAdminUser: {
    request: () => {
      return {
        id: { type: 'string', required: true },
        loginPwd: { type: 'string', required: false },
        realName: { type: 'string', required: false },
        roleId: { type: 'int', required: true },
        state: { type: 'int', required: false },
        gender: { type: 'int', required: false },
        branchCode: { type: 'string', required: false },
        remarks: { type: 'string', required: false },
      };
    },
  },
};
